
package cz.czu.pef.DataModelling.domainObjects;

import java.util.*;

public class MedicalExamination extends IdObjectImpl implements IdObject
{
  private static final long serialVersionUID = -3569924077076652811L;

  /*
	 * Entity attributes
	 */
	private Date passedTimestamp;
	private MedicalExaminationType medicalExaminationType;

	/*
	 * Relations
	 */
	private Set<Person> persons;


	public MedicalExamination()
	{
		super();
	}

	public MedicalExamination(MedicalExaminationType medType, Date passTimestamp)
	{
		super();
		setMedicalExaminationType(medType);
		setPassedTimestamp(passTimestamp);
	}

	public MedicalExaminationType getMedicalExaminationType()
	{
		return medicalExaminationType;
	}

	public void setMedicalExaminationType(MedicalExaminationType medicalExaminationType)
	{
		this.medicalExaminationType = medicalExaminationType;
	}

	public Date getExpiration()
	{
		// TODO: Compute expiration here from Employee => Roles => RoleType => 
		return null;
	}
	
	public Date getPassedTimestamp()
	{
		return passedTimestamp;
	}

	public void setPassedTimestamp(Date passedTimestamp)
	{
		this.passedTimestamp = passedTimestamp;
	}

	public Set<Person> getPersons()
	{
		return persons;
	}

	public List<Person> getPersonsAsList()
	{
		return new ArrayList<Person>(getPersons());
	}

	
  public void setPersons(Set<Person> persons)
  {
    this.persons = persons;
  }

  public String toString()
	{
		StringBuilder builder = new StringBuilder();
		builder.append("MedicalExamination [passedTimestamp=");
		builder.append(passedTimestamp);
		builder.append(", medicalExaminationType=");
		builder.append(medicalExaminationType);
		builder.append(", toString()=");
		builder.append(super.toString());
		builder.append("]");
		return builder.toString();
	}
}